/*
 * Copyright (C) 2011 JiangHongTiao <jjurco.sk_gmail.com>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package sk.lieskove.jianghongtiao.websearch.service;

import sk.lieskove.jianghongtiao.websearch.persistence.WebSearchResponse;
import sk.lieskove.jianghongtiao.common.enums.searchserviceenum.SearchServiceEnum;

import java.util.List;

/**
 * Date of create: Oct 9, 2011
 *
 * @author JiangHongTiao <jjurco.sk_gmail.com>
 * @version 2011.1009
 */
public interface SearchService {
    
    /**
     * Search through all services available in the search service manager.
     * 
     * @param query Query to search for. Depends on service, it can search for basic 
     * query or full query.
     * @return list of responses
     */
    public List<WebSearchResponse> searchAll(SearchQuery query);
    /**
     * Search through all services available in the search service manager
     * @param query Query to search for. Depends on service, it can search for basic 
     * query or full query.
     * @param numberOfResults maximal number of results to get from every search service.
     * It means, when implementation supports 5 services and the value of this
     * parameter is 50 you will receive at most 250 responses
     * @return list of responses
     */
    public List<WebSearchResponse> searchAll(SearchQuery query, int numberOfResults);
    
    /**
     * Search for Query through selected services. Search query every service
     * and gather results together. All results are collected or maximum number
     * of results specified in the configuration file for the service. 
     * 
     * @param query Query to search. Depends on service, it can search for basic 
     * query or full query.
     * @param services list of services where to search. Not known service or not
     * supported service is ignored.
     * @return list of responses
     */
    public List<WebSearchResponse> search(SearchQuery query, SearchServiceEnum[] services);
    
    /**
     * Search for Query through selected services. Search query every service
     * and gather results together. All results are collected or maximum number
     * of results specified in the configuration file for the service. 
     * 
     * @param query Query to search. Depends on service, it can search for basic 
     * query or full query.
     * @param numberOfResults  maximal number of results to get from every search service.
     * It means, when implementation supports 5 services and the value of this
     * parameter is 50 you will receive at most 250 responses
     * @param services list of services where to search. Not known service or not
     * supported service is ignored.
     * @return list of responses
     */
    public List<WebSearchResponse> search(SearchQuery query, int numberOfResults, SearchServiceEnum[] services);
    
}
